FROM ubuntu:20.04

COPY boot /root/boot/

ENV DEBIAN_FRONTEND=noninteractive \
    PATH=/root/boot:/root/ob/bin:/u01/obclient/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
    LD_LIBRARY_PATH=LD_LIBRARY_PATH:/root/ob/lib \
    TERM=dumb


RUN set -eux; \
    apt-get update && apt-get install -y \
    libaio-dev  \
    krb5-locales  \
    libk5crypto3  \ 
    libkeyutils1  \ 
    libkrb5-3  \ 
    libkrb5support0 \ 
#    vim  \
    wget \
#    procps \
    libssl1.1 && \
    mkdir /root/pkg && cd /root/pkg/ && useradd admin && \
    wget -O /root/pkg/oceanbase-ce-libs-3.1.4-10000092022071511.el7.x86_64.rpm https://mdn.alipayobjects.com/ob_portal/afts/file/A*yAluQr0F5gsAAAAAAAAAAAAADWF2AQ?af_fileName=oceanbase-ce-libs-3.1.4-10000092022071511.el7.x86_64.rpm -q && \
    wget -O /root/pkg/oceanbase-ce-3.1.4-10000092022071511.el7.x86_64.rpm https://mdn.alipayobjects.com/ob_portal/afts/file/A*qjwRQ66mcuUAAAAAAAAAAAAADWF2AQ?af_fileName=oceanbase-ce-3.1.4-10000092022071511.el7.x86_64.rpm  -q  && \
    wget -O /root/pkg/obclient-3.1.4.tar.gz https://gitee.com/lee1002/oceanbase-depend/releases/download/oceanbase-3.1.4_depend_for_ubuntu/obclient-3.1.4.tar.gz -q  && \
    wget -O /root/pkg/oceanbase-ce-libs_3.1.4-10000092022071511.el7_amd64.deb https://gitee.com/lee1002/oceanbase-depend/releases/download/oceanbase-3.1.4_depend_for_ubuntu/oceanbase-ce-libs_3.1.4-10000092022071511.el7_amd64.deb -q && \
    wget -O /root/pkg/libobclient_2.0.2-2.el7_amd64.deb https://gitee.com/lee1002/oceanbase-depend/releases/download/oceanbase-3.1.4_depend_for_ubuntu/libobclient_2.0.2-2.el7_amd64.deb  -q && \
    wget -O /root/pkg/ob-deploy_1.5.0-12.el7_amd64.deb https://gitee.com/lee1002/oceanbase-depend/releases/download/oceanbase-3.1.4_depend_for_ubuntu/ob-deploy_1.5.0-12.el7_amd64.deb  -q && \
    dpkg --no-force-overwrite -i ob-deploy_1.5.0-12.el7_amd64.deb && \
    dpkg --no-force-overwrite -i oceanbase-ce-libs_3.1.4-10000092022071511.el7_amd64.deb && \
    dpkg --no-force-overwrite -i libobclient_2.0.2-2.el7_amd64.deb && \
    tar -xf /root/pkg/obclient-3.1.4.tar.gz -C / && \
    cd /root/pkg && \
    rm -rf /usr/obd/mirror/remote/* &&\
    rm -f obclient-3.1.4.tar.gz ob-deploy_1.5.0-12.el7_amd64.deb libobclient_2.0.2-2.el7_amd64.deb && \
    apt clean -y && \   
    rm -rf \
    /var/cache/debconf/* \
    /var/lib/apt/lists/* \
    /var/log/* \
    /var/tmp/* \
    rm -rf /tmp/* 


WORKDIR /root

ENTRYPOINT ["/root/boot/_boot"]
CMD ["observer"]
